package com.algebra.active.service.impl;

import com.algebra.active.domain.WorkflowNodeDto;
import org.slf4j.MDC;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.algebra.active.domain.WorkflowNode;
import com.algebra.active.mapper.WorkflowNodeMapper;
import com.algebra.active.service.WorkflowNodeService;

import java.util.HashMap;
import java.util.Map;

/**
  * @author al
  * @date 2020/6/10 15:21
  * @description 
  */
@Service
public class WorkflowNodeServiceImpl implements WorkflowNodeService{

    @Resource
    private WorkflowNodeMapper workflowNodeMapper;

    @Override
    public int deleteByPrimaryKey(String nodeId,String procDefId) {
        return workflowNodeMapper.deleteByPrimaryKey(nodeId,procDefId);
    }

    @Override
    public int insertSelective(WorkflowNode record) {
        return workflowNodeMapper.insertSelective(record);
    }

    @Override
    public WorkflowNode selectByPrimaryKey(String nodeId,String procDefId) {
        return workflowNodeMapper.selectByPrimaryKey(nodeId,procDefId);
    }

    @Override
    public int updateByPrimaryKeySelective(WorkflowNode record) {
        return workflowNodeMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public WorkflowNodeDto getCurrentNodeInfo(String nodeId, String procDefId, String clientId) {
        return workflowNodeMapper.getCurrentNodeInfo(nodeId,procDefId,clientId);
    }

    @Override
    public WorkflowNodeDto getNextNodeInfo(String srcNodeId, String condition, String procDefId, String clientId) {
        Map<String,Object> param = new HashMap<>();
        param.put("srcNodeId", srcNodeId);
        param.put("condition", condition);
        param.put("procDefId", procDefId);
        param.put("clientId", clientId);
        return workflowNodeMapper.getNextNodeInfo(param);
    }


}
